import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeviceOrderVO, DeviceOrderForm, DeviceOrderQuery } from '@/api/authcode/deviceOrder/types';

/**
 * 查询设备订购信息列表
 * @param query
 * @returns {*}
 */

export const listDeviceOrder = (query?: DeviceOrderQuery): AxiosPromise<DeviceOrderVO[]> => {
  return request({
    url: '/authcode/deviceOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备订购信息详细
 * @param id
 */
export const getDeviceOrder = (id: string | number): AxiosPromise<DeviceOrderVO> => {
  return request({
    url: '/authcode/deviceOrder/' + id,
    method: 'get'
  });
};

/**
 * 新增设备订购信息
 * @param data
 */
export const addDeviceOrder = (data: DeviceOrderForm) => {
  return request({
    url: '/authcode/deviceOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备订购信息
 * @param data
 */
export const updateDeviceOrder = (data: DeviceOrderForm) => {
  return request({
    url: '/authcode/deviceOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备订购信息
 * @param id
 */
export const delDeviceOrder = (id: string | number | Array<string | number>) => {
  return request({
    url: '/authcode/deviceOrder/' + id,
    method: 'delete'
  });
};
